<!DOCTYPE html>
<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册 - AI面试助手</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
          integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
    <!-- Bootstrap Icons -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    <style>
        /* CSS变量定义 */
        :root {
            --primary-gradient: linear-gradient(135deg, #28a745 0%, #20c997 100%);
            --primary-color: #28a745;
            --secondary-color: #20c997;
            --text-color: #333;
            --text-muted: #6c757d;
            --white: #ffffff;
            --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
            --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.05);
            --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.1);
            --border-radius: 15px;
        }
        
        /* 基础样式 */
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: var(--primary-gradient);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0;
            padding: 20px;
        }
        
        /* 注册容器 */
        .register-container {
            max-width: 500px;
            width: 100%;
            perspective: 1000px;
        }
        
        /* 卡片样式 */
        .card {
            border-radius: var(--border-radius);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
            border: none;
            transition: transform 0.3s ease;
            transform-style: preserve-3d;
        }
        
        .card:hover {
            transform: translateY(-5px);
        }
        
        .card-header {
            background: var(--primary-gradient);
            color: var(--white);
            padding: 1.5rem;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        
        .card-header::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
            transform: rotate(45deg);
            animation: shimmer 2s infinite;
        }
        
        @keyframes shimmer {
            0% {
                transform: rotate(45deg) translateX(-100%);
            }
            100% {
                transform: rotate(45deg) translateX(100%);
            }
        }
        
        .card-body {
            padding: 2rem;
            background-color: var(--white);
        }
        
        /* 表单样式 */
        .form-label {
            font-weight: 600;
            color: var(--text-color);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-bottom: 0.5rem;
        }
        
        .form-control {
            border: 2px solid #e9ecef;
            border-radius: 8px;
            padding: 0.75rem 1rem;
            transition: all 0.3s ease;
            font-size: 1rem;
        }
        
        .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
            outline: none;
            transform: translateY(-1px);
        }
        
        /* 按钮样式 */
        .btn-success {
            background: var(--primary-gradient);
            border: none;
            transition: all 0.3s ease;
            width: 100%;
            padding: 0.75rem 1rem;
            font-weight: 600;
            border-radius: 8px;
            position: relative;
            overflow: hidden;
            z-index: 1;
        }
        
        .btn-success::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transition: all 0.5s ease;
            z-index: -1;
        }
        
        .btn-success:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(40, 167, 69, 0.3);
        }
        
        .btn-success:hover::before {
            left: 100%;
        }
        
        /* 链接样式 */
        .login-link {
            text-align: center;
            margin-top: 1.5rem;
            font-size: 0.95rem;
        }
        
        a {
            color: var(--primary-color);
            text-decoration: none;
            transition: all 0.3s ease;
            position: relative;
        }
        
        a:hover {
            color: var(--secondary-color);
        }
        
        a::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 0;
            height: 2px;
            background-color: var(--primary-color);
            transition: width 0.3s ease;
        }
        
        a:hover::after {
            width: 100%;
        }
        
        /* 提示信息样式 */
        .alert {
            margin-bottom: 1.5rem;
            border-radius: 8px;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem 1rem;
            border: none;
        }
        
        .alert i {
            flex-shrink: 0;
        }
        
        /* 淡入动画 */
        .fade-in {
            animation: fadeIn 0.8s ease-in-out;
            opacity: 0;
            animation-fill-mode: forwards;
        }
        
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        /* 表单输入焦点效果 */
        .input-group {
            position: relative;
        }
        
        .input-group i {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted);
            pointer-events: none;
        }
        
        .input-with-icon {
            padding-left: 40px !important;
        }
        
        /* 表单分组 */
        .form-row {
            display: flex;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }
        
        .form-row .input-group {
            flex: 1;
        }
        
        /* 响应式优化 */
        @media (max-width: 768px) {
            .form-row {
                flex-direction: column;
                gap: 0;
            }
            
            .form-row .mb-4 {
                margin-bottom: 1.5rem !important;
            }
        }
        
        @media (max-width: 576px) {
            .card-body {
                padding: 1.5rem;
            }
            
            .form-control {
                padding: 0.65rem 1rem;
            }
        }
    </style>
</head>
<body>
    <div class="register-container">
        <div class="card fade-in">
            <div class="card-header">
                <h3 class="mb-0">
                    <i class="bi bi-person-plus"></i> 用户注册
                </h3>
            </div>
            <div class="card-body">
                <!-- 错误信息显示 -->
                <div th:if="${errorMessage}" class="alert alert-danger">
                    <i class="bi bi-exclamation-circle"></i> <span th:text="${errorMessage}"></span>
                </div>

                <!-- 注册表单 -->
                <form th:action="@{/register}" th:object="${user}" method="post" class="fade-in" style="animation-delay: 0.2s;">
                    <div class="mb-4">
                        <label for="username" class="form-label">
                            <i class="bi bi-person"></i> 用户名
                        </label>
                        <div class="input-group">
                            <i class="bi bi-person"></i>
                            <input type="text" class="form-control input-with-icon" id="username" th:field="*{username}" placeholder="请设置用户名" required autofocus>
                        </div>
                    </div>
                    <div class="mb-4">
                        <label for="password" class="form-label">
                            <i class="bi bi-lock"></i> 密码
                        </label>
                        <div class="input-group">
                            <i class="bi bi-lock"></i>
                            <input type="password" class="form-control input-with-icon" id="password" th:field="*{password}" placeholder="请设置密码" required>
                        </div>
                    </div>
                    <div class="mb-4">
                        <label for="email" class="form-label">
                            <i class="bi bi-envelope"></i> 邮箱
                        </label>
                        <div class="input-group">
                            <i class="bi bi-envelope"></i>
                            <input type="email" class="form-control input-with-icon" id="email" th:field="*{email}" placeholder="请输入邮箱地址" required>
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="mb-4 w-100">
                            <label for="phone" class="form-label">
                                <i class="bi bi-telephone"></i> 电话
                            </label>
                            <div class="input-group">
                                <i class="bi bi-telephone"></i>
                                <input type="tel" class="form-control input-with-icon" id="phone" th:field="*{phone}" placeholder="请输入手机号码" required>
                            </div>
                        </div>
                        <div class="mb-4 w-100">
                            <label for="realName" class="form-label">
                                <i class="bi bi-person-circle"></i> 真实姓名
                            </label>
                            <div class="input-group">
                                <i class="bi bi-person-circle"></i>
                                <input type="text" class="form-control input-with-icon" id="realName" th:field="*{realName}" placeholder="请输入真实姓名" required>
                            </div>
                        </div>
                    </div>
                    <button type="submit" class="btn btn-success">
                        <i class="bi bi-check-circle"></i> 注册
                    </button>
                    <div class="login-link">
                        <span>已有账号？</span>
                        <a th:href="@{/login}" class="font-weight-medium">立即登录</a>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!-- Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
            integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
            crossorigin="anonymous"></script>
    
    <!-- 自定义脚本 -->
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 表单提交动画
            const form = document.querySelector('form');
            const submitButton = form.querySelector('button[type="submit"]');
            
            form.addEventListener('submit', function() {
                submitButton.disabled = true;
                submitButton.innerHTML = '<i class="bi bi-spinner bi-spin"></i> 注册中...';
            });
            
            // 输入框焦点效果
            const inputs = document.querySelectorAll('input');
            inputs.forEach(input => {
                input.addEventListener('focus', function() {
                    this.parentElement.classList.add('input-focused');
                });
                
                input.addEventListener('blur', function() {
                    this.parentElement.classList.remove('input-focused');
                });
            });
            
            // 表单验证增强
            const passwordInput = document.getElementById('password');
            const usernameInput = document.getElementById('username');
            
            usernameInput.addEventListener('input', function() {
                if (this.value.length < 3) {
                    this.classList.add('border-warning');
                    this.classList.remove('border-success');
                } else {
                    this.classList.remove('border-warning');
                    this.classList.add('border-success');
                }
            });
            
            passwordInput.addEventListener('input', function() {
                if (this.value.length < 6) {
                    this.classList.add('border-warning');
                    this.classList.remove('border-success');
                } else {
                    this.classList.remove('border-warning');
                    this.classList.add('border-success');
                }
            });
        });
    </script>
</body>
</html>